package com.tlw.practice.tlw.service;

import com.tlw.practice.tlw.entity.LeaveEntity;
import com.tlw.practice.tlw.pojo.form.RequestLeaveForm;
import com.tlw.practice.tlw.pojo.form.LeaveForm;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.text.ParseException;

public interface LeaveService {
    /**
     * 新增请假单
     * @param requestLeave
     * @return
     */
    int addRequestLeave(LeaveEntity requestLeave);

    /**
     * 删除请假单
     * @param requestId
     * @return
     */
    int deleteRequestLeave(String requestId);

    /**
     * 更新请假单
     * @param requestLeave
     * @param id
     * @return
     * @throws InterruptedException
     */
    int updateRequestLeave(LeaveForm requestLeave, String id) throws InterruptedException;

    /**
     * 通过请假单ID获取单个请假单
     * @param requestId
     * @return
     */
    LeaveEntity findOneRequestLeaveById(String requestId);

    /**
     * 无参数分页查询
     * @param pageable
     * @return
     */
    Page<LeaveEntity> findRequestLeaveNoQuery(Pageable pageable);

    /**
     * 带参数分页查询
     * @param pageable
     * @param query
     * @return
     * @throws ParseException
     */
    Page<LeaveEntity> findRequestLeaveQuery(Pageable pageable, String query) throws ParseException;

}
